package com.ruoyi.system.service.impl;


import com.ruoyi.system.mapper.DataSourceMapper;
import com.ruoyi.system.service.DataSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.sql.*;
import java.util.HashMap;
import java.util.Map;



@Service
public class DataSourceServiceImpl implements DataSourceService {

    // 数据库连接信息
    private static final String DB_URL = "jdbc:mysql://localhost:3306/example?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true";
    private static final String USER = "root";
    private static final String PASS = "123456";


    public void subTable(String merchantId, String storeId) {
        String tableNamePrefix = "_" + merchantId + "_" + storeId;

        try (Connection connection = DriverManager.getConnection(DB_URL, USER, PASS);
             Statement statement = connection.createStatement()) {

            Map<String, String> schemas = new HashMap<>();

            schemas.put("tb_applet_homepage_info", "CREATE TABLE IF NOT EXISTS `tb_applet_homepage_info%s` ("
                    + "`homepage_id` int NOT NULL AUTO_INCREMENT COMMENT '首页id',"
                    + "`tempalte_id` int NULL DEFAULT NULL COMMENT '小程序模板id',"
                    + "`recommends_product_id` int NULL DEFAULT NULL COMMENT '推荐商品id',"
                    + "`broadcast_information` varchar(50) NULL DEFAULT NULL COMMENT '公告/广播信息',"
                    + "`text_intro` varchar(50) NULL DEFAULT NULL COMMENT '文字介绍',"
                    + "`remark` varchar(50) NULL DEFAULT NULL COMMENT '备注',"
                    + "`picture_url` varchar(2000) NULL DEFAULT NULL COMMENT '轮播图路径',"
                    + "`merchant_id` int NULL DEFAULT NULL COMMENT '商家id',"
                    + "`store_id` int NULL DEFAULT NULL COMMENT '店铺id',"
                    + "PRIMARY KEY (`homepage_id`) USING BTREE) ENGINE=InnoDB AUTO_INCREMENT=7 COMMENT='小程序首页信息管理表';");

            schemas.put("tb_company_merchant_chat_record", "CREATE TABLE `tb_company_merchant_chat_record%s` ("
                    + "`record_id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',"
                    + "`merchant_id` int NOT NULL COMMENT '商家ID',"
                    + "`user_id` int NOT NULL COMMENT '公司员工ID',"
                    + "`merchant_order_id` varchar(255) NULL DEFAULT NULL COMMENT '商家订单ID',"
                    + "`message_sender` varchar(255) NULL DEFAULT NULL COMMENT '消息发送者',"
                    + "`message_sent_time` datetime NOT NULL COMMENT '消息发送时间',"
                    + "`message_info` varchar(255) NULL DEFAULT NULL COMMENT '消息内容',"
                    + "PRIMARY KEY (`record_id`) USING BTREE) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='客服聊天记录表';");


            schemas.put("tb_customer_advice", "CREATE TABLE IF NOT EXISTS `tb_customer_advice%s` ("
                    + "`advice_id` int NOT NULL COMMENT '意见建议id',"
                    + "`stores_id` int NULL DEFAULT NULL COMMENT '店铺id',"
                    + "`customer_id` int NULL DEFAULT NULL COMMENT '顾客id',"
                    + "`advice_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '意见建议内容',"
                    + "PRIMARY KEY (`advice_id`) USING BTREE) ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='顾客：意见建议表' ROW_FORMAT=DYNAMIC;");

            schemas.put("tb_customer_info", "CREATE TABLE `tb_customer_info%s`  (\n" +
                    "  `customer_id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',\n" +
                    "  `customer_photo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户头像',\n" +
                    "  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '手机号',\n" +
                    "  `customer_points` int NOT NULL COMMENT '积分',\n" +
                    "  `customer_birthday` date NULL DEFAULT NULL COMMENT '生日',\n" +
                    "  `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '昵称',\n" +
                    "  PRIMARY KEY (`customer_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '顾客：用户信息表' ROW_FORMAT = DYNAMIC;");




            schemas.put("tb_customer_order", "CREATE TABLE `tb_customer_order%s`  (\n" +
                    "  `order_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单ID，订单号',\n" +
                    "  `customer_id` int NULL DEFAULT NULL COMMENT '顾客id',\n" +
                    "  `order_time` datetime NOT NULL COMMENT '订单时间（包括日期和时间）',\n" +
                    "  `order_price` double NULL DEFAULT NULL COMMENT '订单总价',\n" +
                    "  `order_point` int NULL DEFAULT 0 COMMENT '根据消费金额所增加的积分',\n" +
                    "  `order_status_id` int NULL DEFAULT NULL COMMENT '订单状态id',\n" +
                    "  `order_comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '顾客评价，用户对订单服务的评价',\n" +
                    "  `order_callnum` int NULL DEFAULT NULL COMMENT '叫餐号',\n" +
                    "  `store_id` int NULL DEFAULT NULL COMMENT '店铺id',\n" +
                    "  `merchant_id` int NULL DEFAULT NULL COMMENT '商家id',\n" +
                    "  PRIMARY KEY (`order_number`) USING BTREE\n" +
                    ") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '顾客：订单表  \\r\\n\\r\\n包括订单号、订单评价、顾客id、积分、叫餐号、订单状态、订单价格、订单生成日期' ROW_FORMAT = DYNAMIC;");



            schemas.put("tb_customer_order_detail", "CREATE TABLE `tb_customer_order_detail%s`  (\n" +
                    "  `order_detail_id` int NOT NULL AUTO_INCREMENT COMMENT '订单详情id',\n" +
                    "  `order_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '订单号',\n" +
                    "  `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品名',\n" +
                    "  `specifications` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品规格',\n" +
                    "  `product_num` int NULL DEFAULT NULL COMMENT '商品数量',\n" +
                    "  PRIMARY KEY (`order_detail_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 131312329 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商家-顾客：订单详情表\\r\\n买了什么东西 、  数量  、  价格' ROW_FORMAT = DYNAMIC;");



            schemas.put("CREATE TABLE `tb_customer_point_change", "CREATE TABLE `tb_customer_point_change%s`  (\n" +
                    "  `record_id` int NOT NULL COMMENT '记录id',\n" +
                    "  `order_id` int NULL DEFAULT NULL COMMENT '订单id',\n" +
                    "  `customer_id` int NULL DEFAULT NULL COMMENT '顾客id',\n" +
                    "  `total_point` int NULL DEFAULT NULL COMMENT '积分总量',\n" +
                    "  `update_time` datetime NULL DEFAULT NULL COMMENT '变化时间',\n" +
                    "  PRIMARY KEY (`record_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '顾客：积分变化表  \\r\\n增加减少都是变化' ROW_FORMAT = DYNAMIC;\n");



            schemas.put("tb_employee_info", "CREATE TABLE `tb_employee_info%s`  (\n" +
                    "  `employee_id` int NOT NULL AUTO_INCREMENT COMMENT '员工ID，主键',\n" +
                    "  `employee_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '员工姓名',\n" +
                    "  `employee_gender` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '员工性别，M表示男，F表示女',\n" +
                    "  `employee_age` int NOT NULL COMMENT '员工年龄',\n" +
                    "  `employee_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '员工电话号码',\n" +
                    "  `idcard` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '员工身份证号码，唯一标识',\n" +
                    "  `employee_position_id` int NULL DEFAULT NULL COMMENT '员工职位ID',\n" +
                    "  `merchant_id` int NULL DEFAULT NULL COMMENT '店铺id',\n" +
                    "  PRIMARY KEY (`employee_id`) USING BTREE,\n" +
                    "  UNIQUE INDEX `IdentityCard`(`idcard` ASC) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '店员信息表' ROW_FORMAT = DYNAMIC;\n");



            schemas.put("tb_employee_position", "CREATE TABLE `tb_employee_position%s`  (\n" +
                    "  `employee_position_id` int NOT NULL COMMENT '员工职位id',\n" +
                    "  `position_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '职位名称',\n" +
                    "  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',\n" +
                    "  PRIMARY KEY (`employee_position_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '员工职位表' ROW_FORMAT = DYNAMIC;");



            schemas.put("tb_home_recommends_product", "CREATE TABLE `tb_home_recommends_product%s`  (\n" +
                    "  `recommends_product_id` int NOT NULL AUTO_INCREMENT,\n" +
                    "  `homepage_id` int NULL DEFAULT NULL,\n" +
                    "  `product_id` int NULL DEFAULT NULL,\n" +
                    "  PRIMARY KEY (`recommends_product_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '首页推荐商品表' ROW_FORMAT = Dynamic;\n");


            schemas.put("tb_homepage_picture_association", "CREATE TABLE `tb_homepage_picture_association%s`  (\n" +
                    "  `association_id` int NOT NULL COMMENT '轮播图id',\n" +
                    "  `homepage_id` int NULL DEFAULT NULL COMMENT '首页id',\n" +
                    "  `homepage_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '首页图片',\n" +
                    "  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',\n" +
                    "  PRIMARY KEY (`association_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '首页-轮播图关联表\\r\\n' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_merchant_customer_chat_record", "CREATE TABLE `tb_merchant_customer_chat_record%s`  (\n" +
                    "  `record_id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID',\n" +
                    "  `customer_id` int NOT NULL COMMENT '顾客ID',\n" +
                    "  `merchant_id` int NOT NULL COMMENT '商家ID',\n" +
                    "  `order_id` int NULL DEFAULT NULL COMMENT '订单ID',\n" +
                    "  `message_sender` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '消息发送者',\n" +
                    "  `message_sent_time` timestamp NOT NULL COMMENT '消息发送时间',\n" +
                    "  `message_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '消息内容',\n" +
                    "  `store_id` int NULL DEFAULT NULL COMMENT '店铺id',\n" +
                    "  PRIMARY KEY (`record_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商家-顾客聊天记录表' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_product", "CREATE TABLE `tb_product%s`  (\n" +
                    "  `product_id` int NOT NULL AUTO_INCREMENT COMMENT '商品ID，主键',\n" +
                    "  `product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',\n" +
                    "  `product_photo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品图片',\n" +
                    "  `product_detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '商品详情',\n" +
                    "  `category_id` int NULL DEFAULT NULL COMMENT '类别ID',\n" +
                    "  `price` double NULL DEFAULT NULL COMMENT '商品价格（中份价格）',\n" +
                    "  `max_price` double NULL DEFAULT NULL COMMENT '大份价格',\n" +
                    "  `min_price` double NULL DEFAULT NULL COMMENT '小份价格',\n" +
                    "  `sale_num` int NULL DEFAULT 0 COMMENT '销量',\n" +
                    "  `is_discount` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '0' COMMENT '是否折扣，0表示无折扣，1表示有折扣',\n" +
                    "  `is_on_sale` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '1' COMMENT '上下架状态，0表示下架,1表示上架',\n" +
                    "  `discont_strength` double NULL DEFAULT NULL COMMENT '折扣力度（xx折，比如：95折）',\n" +
                    "  `store_id` int NULL DEFAULT NULL COMMENT '店铺id',\n" +
                    "  `merchant_id` int NULL DEFAULT NULL COMMENT '商家id',\n" +
                    "  `database_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '库名',\n" +
                    "  `table_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '表名',\n" +
                    "  PRIMARY KEY (`product_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品信息表 ：与店铺关联' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("CREATE TABLE `tb_product_category", "CREATE TABLE `tb_product_category%s`  (\n" +
                    "  `category_id` int NOT NULL AUTO_INCREMENT COMMENT '类别ID，唯一标识每个商品类别',\n" +
                    "  `category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '类别名称，商品类别的具体名称',\n" +
                    "  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注，关于商品类别的额外信息或说明',\n" +
                    "  PRIMARY KEY (`category_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品类别表：也可以走字典' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_product_inventory", "CREATE TABLE `tb_product_inventory%s`  (\n" +
                    "  `inventory_id` int NOT NULL AUTO_INCREMENT COMMENT '库存id',\n" +
                    "  `merchant_id` int NULL DEFAULT NULL COMMENT '店铺id（store_id不是merchant_id）',\n" +
                    "  `product_id` int NULL DEFAULT NULL COMMENT '商品id',\n" +
                    "  `inventory_num` int NULL DEFAULT NULL COMMENT '库存数量',\n" +
                    "  `store_id` int NULL DEFAULT NULL COMMENT '商家id（反了）',\n" +
                    "  PRIMARY KEY (`inventory_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品库存表' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_product_package", "CREATE TABLE `tb_product_package%s`  (\n" +
                    "  `package_id` int NOT NULL AUTO_INCREMENT COMMENT '套餐id',\n" +
                    "  `package_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '套餐名',\n" +
                    "  `package_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '套餐图片',\n" +
                    "  `package_price` double NULL DEFAULT NULL COMMENT '套餐价格',\n" +
                    "  `package_status` int NULL DEFAULT NULL COMMENT '套餐状态',\n" +
                    "  `merchant_id` int NULL DEFAULT NULL COMMENT '商家id',\n" +
                    "  `store_id` int NULL DEFAULT NULL COMMENT '店铺id',\n" +
                    "  PRIMARY KEY (`package_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品套餐表' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_product_package_association", "CREATE TABLE `tb_product_package_association%s`  (\n" +
                    "  `association_id` int NOT NULL AUTO_INCREMENT COMMENT '关联id',\n" +
                    "  `package_id` int NULL DEFAULT NULL COMMENT '套餐id',\n" +
                    "  `product_id` int NULL DEFAULT NULL COMMENT '商品id',\n" +
                    "  `product_num` int NULL DEFAULT NULL COMMENT '商品数量',\n" +
                    "  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',\n" +
                    "  PRIMARY KEY (`association_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品-套餐关联表\\r\\n套餐里面包含了哪些商品' ROW_FORMAT = DYNAMIC;\n");

            schemas.put("tb_product_specification_price", "CREATE TABLE `tb_product_specification_price%s`  (\n" +
                    "  `specification_id` int NOT NULL AUTO_INCREMENT COMMENT '规格ID，主键',\n" +
                    "  `product_id` int NULL DEFAULT NULL COMMENT '商品ID，关联到商品表（假设存在，但此处不建外键）',\n" +
                    "  `specification_details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品规格详情',\n" +
                    "  `price` double NOT NULL COMMENT '商品对应规格的价格',\n" +
                    "  PRIMARY KEY (`specification_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品规格及价格表\\r\\nSKU：对应每种规格多少钱 （小份、中份、大份）' ROW_FORMAT = DYNAMIC;\n");

            schemas.put("tb_service_content", "CREATE TABLE `tb_service_content%s`  (\n" +
                    "  `service_id` int NOT NULL AUTO_INCREMENT COMMENT '服务id',\n" +
                    "  `service_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '服务内容',\n" +
                    "  `service_price` double NULL DEFAULT NULL COMMENT '单个服务的价格',\n" +
                    "  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注内容，关于配置内容的额外说明或备注',\n" +
                    "  PRIMARY KEY (`service_id`) USING BTREE\n" +
                    ") ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '服务内容表\\r\\n（有哪些单项服务）' ROW_FORMAT = DYNAMIC;\n");


            schemas.put("tb_shopping_cart", "CREATE TABLE `tb_shopping_cart%s`  (\n" +
                    "  `shopping_cart_id` int NOT NULL COMMENT '购物车id',\n" +
                    "  `product_id` int NULL DEFAULT NULL COMMENT '商品id',\n" +
                    "  `specification_id` int NULL DEFAULT NULL COMMENT '规格ID，如果有的话（可为空）',\n" +
                    "  `package_id` int NULL DEFAULT NULL COMMENT '套餐id',\n" +
                    "  `num` int NOT NULL COMMENT '商品数量(包括套餐的数量)',\n" +
                    "  `customer_id` int NOT NULL COMMENT '用户ID'\n" +
                    ") ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '购物车商品表：购物车里面有什么东西' ROW_FORMAT = DYNAMIC;\n");



            for (Map.Entry<String, String> entry : schemas.entrySet()) {
                String tableName = tableNamePrefix; // 获取后缀名
                String createTableSQL = String.format(entry.getValue(), tableName); // 生成 SQL

                try (PreparedStatement preparedStatement = connection.prepareStatement(createTableSQL)) {
                    preparedStatement.execute(); // 执行 SQL
                }
            }
        } catch (SQLException e) {
            e.printStackTrace(); // 更具体的异常处理
        }
    }

}
